<?php
$db=new PDO('mysql:host=localhost;dbname=db','root','12qwas');
$db->exec("create database if not exists db3");
$db->exec("use db3");
$db->exec("create table if not exists students(xh varchar(9) primary key, name varchar(50),age int default 0)");
$r=$db->exec("delete from students where age>18");
echo "成功删除年龄大于18的{$r}记录~\n";
$r=$db->exec("truncate table students");
var_dump($r);
$r=$db->exec("insert into students (xh,name,age) values ('233110111','张三',18),('233110112','李四',20),('233110113','王五',19)");
echo "成功插入了{$r}条记录~\n";
$r=$db->exec("update students set name ='张三丰' where xh='233110111'");
echo "成功修改了{$r}条记录~\n";
